home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntinc20 / linea.h < prev    next >
C/C++ Source or Header  |  1992-05-15  |  40KB  |  997 lines

  1. /*
  2.  * Common include file for C interface  to low level Line A calls
  3.  *
  4.  *    ++jrb    bammi@dsrgsun.ces.cwru.edu
  5.  */
  6.  
  7. #ifndef _LINEA_H
  8. #define _LINEA_H
  9.  
  10. #ifndef _COMPILER_H
  11. #include <compiler.h>
  12. #endif
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17.  
  18. /*****************************************************************************\
  19. *                                                                      *
  20. *                                 Defines                                     *
  21. *                                          *
  22. \*****************************************************************************/
  23.  
  24. /*
  25.  *  Object colors (default pallette)
  26.  *
  27.  */
  28. #define WHITE    0
  29. #define BLACK    1
  30. #define RED      2
  31. #define GREEN    3
  32. #define BLUE     4
  33. #define CYAN     5
  34. #define YELLOW   6
  35. #define MAGENTA  7
  36. #define LWHITE   8
  37. #define LBLACK   9
  38. #define LRED     10
  39. #define LGREEN   11
  40. #define LBLUE    12
  41. #define LCYAN    13
  42. #define LYELLOW  14
  43. #define LMAGENTA 15
  44.  
  45.  
  46. /* 
  47.  * Vdi writing modes
  48.  *
  49.  */
  50. #define MD_REPLACE 1
  51. #define MD_TRANS   2
  52. #define MD_XOR     3
  53. #define MD_ERASE   4
  54.  
  55.  
  56. /*
  57.  * Raster Op Codes
  58.  *
  59.  */
  60. #define ALL_WHITE  0
  61. #define S_AND_D    1
  62. #define    S_AND_NOTD 2
  63. #define S_ONLY     3
  64. #define NOTS_AND_D 4
  65. #define    D_ONLY     5
  66. #define S_XOR_D    6
  67. #define S_OR_D     7
  68. #define    NOT_SORD   8
  69. #define    NOT_SXORD  9
  70. #define D_INVERT  10
  71. #define    NOT_D     10
  72. #define    S_OR_NOTD 11
  73. #define NOT_S      12
  74. #define NOTS_OR_D 13
  75. #define    NOT_SANDD 14
  76. #define ALL_BLACK 15
  77.  
  78. /*
  79.  * Sprite formats
  80.  *
  81.  */
  82. #define SP_VDI        0
  83. #define SP_XOR        1
  84.  
  85. /*
  86.  * Line A Opcodes
  87.  *
  88.  */
  89. #define    INIT        0
  90. #define PUTPIXEL    1
  91. #define GETPIXEL    2
  92. #define LINE        3
  93. #define HLINE        4
  94. #define RECTANGLE    5
  95. #define FPOLYGON    6
  96. #define BITBLT        7
  97. #define TEXTBLT        8
  98. #define SHOWMOUSE    9
  99. #define HIDEMOUSE    10
  100. #define TRANMOUSE    11
  101. #define USPRITE        12
  102. #define DSPRITE        13
  103. #define CPYRASTER    14
  104. #define FSEEDFILL    15    /* ROM TOS only    */
  105.  
  106.  
  107. /*****************************************************************************\
  108. *                                                                      *
  109. *                                 Types                                       *
  110. *                                          *
  111. \*****************************************************************************/
  112.  
  113.     /*
  114.      * Global Variables at negative offsets from the Line A parameter
  115.      * block address returned by init. (I have no way of telling if this
  116.      * list is complete).
  117.      *
  118.      */
  119. /* Name   Offset  Type    Description                         */
  120. /* --------------------------------------------------------------------------*/
  121. /* V_BYTES_LIN -2  W    bytes/line for font                     */
  122. /* V_Y_MAX    -4   W    Max Y pixel value of the screen                 */
  123. /* V_STATUS   -6   W    Text Status byte                     */
  124. /*               Bit    Field        Zero        One         */
  125. /*              0    cursor flash    disabled    enabled         */
  126. /*              1    flash state     off        on         */
  127. /*              2    cursor visible  no        yes          */
  128. /*              3     end of line     no-wrap        wrap         */
  129. /*              4     inverse video   on              off          */
  130. /*                        5     cursor saved    false           true         */
  131. /* V_OFF_AD  -10   L    Font offset table address                 */
  132. /* V_X_MAX   -12   W    Max X pixel value                     */
  133. /* V_FNT_WR  -14   W    Width of Font Form in bytes (see type FONT below)    */
  134. /* V_FNT_ST  -16   W    First font ASCII code (first_ade)             */
  135. /* V_FNT_ND  -18   W    Last  font ASCII code (last_ade )                    */
  136. /* V_FNT_AD  -22   L    Font Form address                     */
  137. /*            Mono Spaced, 8 pixels wide and byte aligned, any ht. */
  138. /* V_CUR_TIM -23   B    Cursor countdown timer                     */
  139. /* V_CUR_CNT -24   B    Cursor flash interval( in frames)             */
  140. /* V_CUR_CY  -26   W    Y cursor position                     */
  141. /* V_CUR_CX  -28   W    X cursor position                     */
  142. /* V_CUR_OFF -30   W    Offset from screen base to first cell (bytes)         */
  143. /* V_CUR_AD  -34   L    Current cursor address                     */
  144. /* V_COL_FG  -36   W    Foreground color index                     */
  145. /* V_COL_BG  -38   W    Background color index                     */
  146. /* V_CEL_WR  -40   W    Offset to next vertical cell (bytes)             */
  147. /* V_CEL_MY  -42   W    Max cells high - 1                     */
  148. /* V_CEL_MX  -44   W    Max cells across - 1                     */
  149. /* V_CEL_HT  -46   W    Cell height in pixels (font form's height)         */
  150. /* --------------------------------------------------------------------------*/
  151.  
  152. /*
  153.  * Atari finally named these variables
  154.  * so here they are
  155.  *
  156.  */
  157. #define V_CEL_HT    (*((short  *)((char  *)__aline + -46L)))
  158. #define V_CEL_MX    (*((short  *)((char  *)__aline + -44L)))
  159. #define V_CEL_MY    (*((short  *)((char  *)__aline + -42L)))
  160. #define V_CEL_WR    (*((short  *)((char  *)__aline + -40L)))
  161. #define V_COL_BG    (*((short  *)((char  *)__aline + -38L)))
  162. #define V_COL_FG    (*((short  *)((char  *)__aline + -36L)))
  163. #define V_CUR_AD    (*((char  **)((char  *)__aline + -34L)))
  164. #define V_CUR_OFF   (*((short  *)((char  *)__aline + -30L)))
  165. #define V_CUR_CX    (*((short  *)((char  *)__aline + -28L)))
  166. #define V_CUR_CY    (*((short  *)((char  *)__aline + -26L)))
  167. #define V_CUR_CNT   (*((char   *)((char  *)__aline + -24L)))
  168. #define V_CUR_TIM   (*(          ((char  *)__aline + -23L)))
  169. #define V_FNT_AD    (*((char  **)((char  *)__aline + -22L)))
  170. #define V_FNT_ND    (*((short  *)((char  *)__aline + -18L)))
  171. #define V_FNT_ST    (*((short  *)((char  *)__aline + -16L)))
  172. #define V_FNT_WR    (*((short  *)((char  *)__aline + -14L)))
  173. #define V_X_MAX     (*((short  *)((char  *)__aline + -12L)))
  174. #define V_OFF_AD    (*((char  **)((char  *)__aline + -10L)))
  175. #define V_STATUS    (*((short  *)((char  *)__aline + -6L)))
  176. #define V_Y_MAX     (*((short  *)((char  *)__aline + -4L)))
  177. #define V_BYTES_LIN (*((short  *)((char  *)__aline + -2L)))
  178.  
  179.      /* more obscure variables again found at negative offset */
  180.  
  181. /* pointer to current font                         */
  182. #define    CUR_FONT    (*((__FONT **)((char *)__aline + -906L)))
  183.  
  184. /* Mouse X hot spot                               */
  185. #define M_POS_HX     (*((short *)((char *)__aline + -856L)))
  186.  
  187. /* Mouse Y hot spot                               */
  188. #define M_POS_HY     (*((short *)((char *)__aline + -854L)))
  189.  
  190. /* writing mode for mouse                        */
  191. #define M_PLANES     (*((short *)((char *)__aline + -852L)))
  192.  
  193. /* mouse bkgd color                                */
  194. #define M_CDB_BG     (*((short *)((char *)__aline + -850L)))
  195.  
  196. /* mouse fgd color                                 */
  197. #define M_CDB_FG     (*((short *)((char *)__aline + -848L)))
  198.  
  199. /* mous form, 32 words alternating words: bkgd-0, fgd-0 ... bkgd-15 fgd-16 */
  200. #define MASK_FORM     ((short *)((char *)__aline + -846L))
  201.                  
  202. /* 45 words of vq_extnd                         */
  203. #define INQ_TAB     ((short *)((char *)__aline + -782L))
  204.  
  205. /* 45 words of v_opnwk                          */
  206. #define DEV_TAB     ((short *)((char *)__aline + -692L))
  207.  
  208. /* current mous X                                */
  209. #define GCURX       (*((short *)((char *)__aline + -602L)))
  210.  
  211. /* current mous Y                                */
  212. #define GCURY       (*((short *)((char *)__aline + -600L)))
  213.  
  214. /* current mous hide cnt                        */
  215. #define M_HID_CT     (*((short *)((char *)__aline + -598L)))
  216.  
  217. /* mous button stat, bit0 = left, 1 = right,  0=up, 1=down          */
  218. #define MOUSE_BT     (*((short *)((char *)__aline + -596L)))
  219.                  
  220. /* 3*16 words of vq_color                         */
  221. #define REQ_COL     ((short *)((char *)__aline + -594L))
  222.  
  223. /* 15 words containing text, line and marker sizes in dev coords
  224.      0 min char width
  225.      1 min char height
  226.      2 max char width
  227.      3 max char height
  228.      4 min line width
  229.      5 reserved
  230.      6 max line width
  231.      7 reserved
  232.      8 min marker width
  233.      9 min marker height
  234.     10 max marker width
  235.     11 max marker height
  236.     12-14  RESERVED                                   */
  237. #define SIZ_TAB     ((short *)((char *)__aline + -498L))
  238.  
  239. /* Pointer to current virtual workstation attributes             */
  240. #define CUR_WORK     (*((short **)((char *)__aline + -464L)))
  241.  
  242. /* -> default font hdr                             */
  243. #define DEF_FONT     (*((__FONT **)((char *)__aline + -460L)) )
  244.  
  245.  
  246. /* FONT_RING is an array of four longword pointers to linked lists of
  247. font headers.  The first entry is the head pointer to the font list,
  248. the second and third are continuation fields, and the fourth is a null
  249. terminator.                                 */
  250. #define FONT_RING     ((short *)((char *)__aline + -456L))
  251.  
  252. /*  Number of fonts in the FONT_RING lists                  */
  253. #define FONT_COUNT     (*((short *)((char *)__aline + -440L)))
  254.  
  255. /* Mouse status
  256.      Bit 0 = left mouse button status  (0=up, 1=down)
  257.      Bit 1 = right mouse button status  (0=up, 1=down)
  258.      Bit 2 = reserved
  259.      Bit 3 = reserved
  260.      Bit 4 = reserved
  261.      Bit 5 = mouse movement flag  (0=no movement, 1=movement)
  262.      Bit 6 = right mouse button change flag  (0=nochange, 1=change)
  263.      Bit 7 = left mouse button change flag  (0=nochange, 1=change)      */
  264. #define CUR_MS_STAT     (*((char *)__aline + -348L))
  265.  
  266. /* Hide depth of alpha cursor                         */
  267. #define V_HID_CNT     (*((short *)((char *)__aline + -346L)))
  268.  
  269. /* Mouse cursor X position                         */
  270. #define CUR_X          (*((short *)((char *)__aline + -344L)))
  271.  
  272. /* Mouse cursor Y position                         */
  273. #define CUR_Y       (*((short *)((char *)__aline + -342L)))
  274.  
  275. /* Nonzero = draw mouse form on VBLANK.                 */
  276. #define CUR_FLAG     (*((char *)__aline + -340L))
  277.                             
  278. /* Non-zero if mouse interrupt processing is enabled             */
  279. #define MOUSE_FLAG     (*((char *)__aline + -339L))                    
  280.  
  281. /* Saved alpha cursor X coord                         */
  282. #define V_SAV_X        (*((short *)((char *)__aline + -334L)))
  283.  
  284. /* Saved alpha cursor Y coord                         */
  285. #define V_SAV_Y         (*((short *)((char *)__aline + -332L)))
  286.  
  287. /* height of saved form                         */
  288. #define SAVE_LEN          (*((short *)((char *)__aline + -330L)))
  289.  
  290. /* Screen address of first word saved from screen            */
  291. #define SAVE_ADDR        (*((char **)((char *)__aline + -328L)))
  292.    
  293. /* Save Status
  294.     bit 0 =>  1 = info in buffer is valid.
  295.               0 = info in buffer is not valid.
  296.     bit 1 =>  If 1, double-word wide area was saved.
  297.               If zero, word wide area was saved.
  298.     bits 2-15 RESERVED                             */
  299. #define SAVE_STAT      (*((short *)((char *)__aline + -324L)))
  300.  
  301. /* Save up to 4 planes, 16 longwords per plane.             */
  302. #define SAVE_AREA      ((long *)((char *)__aline + -322L))
  303.           
  304. /* USER_TIM is a pointer to a user installed routine executed on each
  305.    system timer tick.  When done, this routine should jump to the
  306.    address held in NEXT_TIM.  For more information, see the VDI manual
  307.    under Exchange Timer Interrupt Vector.                 */
  308. #define USER_TIM       (*((void(**)())((char *)__aline + -66L)))
  309. #define NEXT_TIM       (*((void(**)())((char *)__aline + -62L)))
  310.           
  311. /* User button vector */          
  312. #define USER_BUT       (*((void(**)())((char *)__aline + -58L)))
  313.  
  314. /* User cursor vector */
  315. #define USER_CUR       (*((void(**)())((char *)__aline + -54L)))
  316.  
  317. /* User motion vector */
  318. #define USER_MOT       (*((void(**)())((char *)__aline + -50L)))
  319.  
  320.  
  321.     /* A pointer to the type LINEA is returned by the Line A init call
  322.      * ($A000), in registers A0 and D0.
  323.          * This pointer is saved in the global variable '__aline'.
  324.      *
  325.      */
  326. typedef struct {
  327.  
  328. /* Type    Name       Offset   Function            Comments             */
  329. /* ------------------------------------------------------------------------- */
  330.    short  _VPLANES;   /*  0  # of Planes     Also see CurrRez            */
  331.    short  _VWRAP;     /*  2  Bytes / scan line    "    "    "                */
  332.               /*     VWRAP can be changed to implement special effect*/
  333.               /*     Doubling VWRAP will skip every other scan line  */
  334.               /*                                 */
  335.               /*                                                     */
  336.    short  *_CONTRL;   /*  4  Ptr to CONTRL Array  Contrl gets set to this    */
  337.    short  *_INTIN;    /*  8  Ptr to INTIN  Array  Intin  gets set to this    */
  338.    short  *_PTSIN;    /* 12  Ptr to PTSIN  Array  Ptsin  gets set to this    */
  339.    short  *_INTOUT;   /* 16  Ptr to INTOUT Array  Intout gets set to this    */
  340.    short  *_PTSOUT;   /* 20  Ptr to PTSOUT Array  Ptsout gets set to this    */
  341.               /*     CONTRL is the control array             */
  342.               /*     INTIN is the array of input parameters         */
  343.               /*     PTSIN is the array of input coordinates         */
  344.               /*      Even entrys are X coordinate             */
  345.               /*       Odd  entrys are corresponding Y coodinates */
  346.               /*     INTOUT is the array of output parameters        */
  347.               /*     PTSOUT is the array of output coordinates       */
  348.               /*    organized like PTSIN.                 */
  349.               /*                                 */
  350.    short  _COLBIT0;   /* 24  Plane 0 Color Value  All Three Rez's         */
  351.    short  _COLBIT1;   /* 26  Plane 1 Color Value  Med and Low Rez only         */
  352.    short  _COLBIT2;   /* 28  Plane 2 Color Value  Low Rez only              */
  353.    short  _COLBIT3;   /* 30  Plane 3 Color Value  Low Rez Only              */
  354.               /*     Foreground color COLBIT0 + 2*COLBIT1 + 4*COLBIT2*/
  355.               /*                  + 8*COLBIT3             */
  356.               /*                                 */
  357.               /*                                                     */
  358.    short  _LSTLIN;    /* 32  Draw last pixel of a line? 0=yes  non0=no         */
  359.               /*     This prevents two connecting lines from XORing  */
  360.               /*     a common endpoint out of existence             */
  361.               /*                                 */
  362.    short  _LNMASK;    /* 34  Linemask used when drawing lines, same as Vdi's */
  363.               /*     line style (rotated to aligned with rightmost   */
  364.               /*     endpoint when drawing lines)                    */
  365.               /*                                 */
  366.    short  _WMODE;     /* 36  Writing mode                                    */
  367.               /*     0=Replace Mode-Replace all bits in Dest with src*/
  368.               /*     1=Trans. Mode-Only additional bits in src set(OR*/
  369.               /*     2=Xor Mode- Src XOR Dest                 */
  370.               /*     3=Inverse Trans.- (NOT src) Or Dest             */
  371.               /*     Values upto 16 are permitted                    */
  372.               /*                                 */
  373.    short  _X1;        /* 38  X1 coordinate used in various calls             */
  374.               /*                                 */
  375.    short  _Y1;        /* 40  Y1 coordinate used in various calls             */
  376.               /*                                 */
  377.    short  _X2;        /* 42  X2 coordinate used in various calls             */
  378.               /*                                 */
  379.    short  _Y2;        /* 44  Y2 coordinate used in various calls             */
  380.               /*                                 */
  381.               /*                                                     */
  382.    short  *_PATPTR;   /* 46  Pointer to current fill pattern                 */
  383.                       /*     Must be integral power of 2 (words) in length   */
  384.    short  _PATMSK;    /* 50  I don't know why they call it a mask. It is in  */
  385.               /*     reality the length in words of the current patt.*/
  386.    short  _MFILL;     /* 52  Multi Plane fill flag 1 == Current fill Pattern */
  387.               /*     is for Muti Plane.                              */
  388.               /*                                                     */
  389.               /*                                                     */
  390.    short  _CLIP;      /* 54  Clipping Flag 1 == TRUE                         */
  391.    short  _XMINCL;    /* 56  Min X of clipping window                 */
  392.    short  _YMINCL;    /* 58  Min Y of clipping window                        */
  393.    short  _XMAXCL;    /* 60  Max X of clipping window                 */
  394.    short  _YMAXCL;    /* 62  Max Y of clipping window                        */
  395.               /*                                                     */
  396.               /*                                                     */
  397.    short  _XDDA;      /* 64  Accumulator for Scaling, Must be set to 0x08000 */
  398.                       /*     before each call to Text Blt. Done for you in   */
  399.               /*     in aline_text()                                 */
  400.    short  _DDAINC;    /* 66  Scaling factor - Fractional amount to scale char*/
  401.               /*     When scaling up = 256 *(Size-Textsize)/Textsize */
  402.               /*     When scaling down = 256*(Size)/Textsize         */
  403.               /*     scaling down does not work                      */
  404.    short  _SCALDIR;   /* 68  Scaling direction 0 == down                     */
  405.    short  _MONO;      /* 70  Mono flag 0== current font is a propotional font*/
  406.               /*     Its Ok for Thickening to increase the width of  */
  407.               /*     the current character.                          */
  408.               /*     1 == current font is mono spaced, so thickening */
  409.               /*     may not increase the width of the current char  */
  410.               /*                                                     */
  411.    short  _SOURCEX;   /* 72  X coordinate of character in the font form      */
  412.               /*     SOURCEX is calculated from info in the font     */
  413.               /*     header for the current font (see __FONT type)   */
  414.               /*     SOURCEX = off_table[char-first_ade]         */
  415.               /*     SOURCEX is calculated for you in aline_text()   */
  416.               /*     The pointer to a table of font header for the   */
  417.               /*     internal fonts is returned in A2 on init (A000) */
  418.    short  _SOURCEY;   /* 74  Y coodinate of character in the font form       */
  419.               /*     Typically set to 0 (top line of font form)         */
  420.    short  _DESTX;     /* 76  X coordinate of character on screen             */
  421.    short  _DESTY;     /* 78  Y coordinate of character on screen             */
  422.    short  _DELX;      /* 80  Width of Character                     */
  423.               /*     Difference between two SOURCEX's                 */
  424.    short  _DELY;      /* 82  Height of Character                             */
  425.               /*     form_height field of FONT_HEAD of current font  */
  426.    short  *_FBASE;    /* 84  Pointer to start of font form                   */
  427.    short  _FWIDTH;    /* 88  Width of the current font's form                */
  428.               /*                                                     */
  429.    short  _STYLE;     /* 90  Vector of style flags                 */
  430.               /*     Bit 0 = Thicken Flag                 */
  431.               /*     Bit 1 = Lighten Flag                 */
  432.               /*     Bit 2 = Skewing Flag                 */
  433.               /*     Bit 3 = Underline Flag (ignored)             */
  434.               /*     Bit 4 = Outline Flag                 */
  435.               /*                                                     */
  436.    short  _LITEMASK;  /* 92  Mask used for lightening text               */
  437.               /*     The Mask is picked up from the font header      */
  438.    short  _SKEWMASK;  /* 94  Mask used for skewing text                 */
  439.               /*     The Mask is picked up from the font header      */
  440.    short  _WEIGHT;    /* 96  The number of bits by which to thicken text     */
  441.               /*     The number is picked up from the font header    */
  442.    short  _ROFF;      /* 98  Offset above baseline when skewing              */
  443.                       /*     Again picked up from the font header            */
  444.               /*                             */
  445.    short  _LOFF;      /* 100 Offset below character baseline when skewing    */
  446.                       /*     Again picked up from the font header            */
  447.               /*                                                     */
  448.    short  _SCALE;     /* 102 Scaling Flag 1 == true                          */
  449.               /*                                                     */
  450.    short  _CHUP;      /* 104 Character rotation vector.                      */
  451.                  /*     0 = normal (0 degrees)                 */
  452.               /*     1800 = 180 degrees                     */
  453.                     /*     2700 = 270 degrees                              */
  454.               /*                                                     */
  455.    short  _TEXTFG;    /* 106 Text foreground color                 */
  456.               /*                                                     */
  457.    char  *_SCRTCHP;   /* 108 Address of buffer required for creating special */
  458.               /*     text effects. The size of this buffer should be */
  459.               /*     1K according the Internals. The Atari document  */
  460.               /*     of course does not talk about such things :-)   */
  461.                       /*                                                     */
  462.    short  _SCRPT2;    /* 112 The offset of the scaling buffer buffer in above*/
  463.                       /*     buffer. Internals suggests an offset of 0x0040  */
  464.                       /*     As usual the Atari document does'nt say a thing */
  465.                       /*                                                     */
  466.    short  _TEXTBG;    /* 114 Text background color (Ram Vdi only)            */
  467.                       /*     used for the BitBlt writing modes (4-19) only   */
  468.                       /*                                                     */
  469.    short  _COPYTRAN;  /* 116 Copy raster form type flag (Ram vdi only)       */
  470.                       /*     0 => Opaque type                                */
  471.                       /*          n-plane source  ->  n-plane dest           */
  472.                       /*              BitBlt writing modes (4-19)            */
  473.                       /*    ~0 => Transparent type                           */
  474.                       /*          1-plane source  ->  n-plane dest           */
  475.                       /*              Vdi writing modes (1-3)                */
  476.                       /*                                                     */
  477.  short(*_SEEDABORT) __PROTO((void));
  478.               /* 118 Pointer to function returning int, which is     */
  479.                       /*     called by the fill logic to allow the fill to   */
  480.                       /*     be aborted. If the routine returns FALSE (0)    */
  481.                       /*     the fill is not aborted. If it returns TRUE (~0)*/
  482.                       /*     the fill is aborted                             */
  483. /* ------------------------------------------------------------------------- */
  484.  
  485. } __LINEA;            /*       P H E W !!!!!                                 */
  486.  
  487. /* macros for MWC compatibility */
  488. #define    VPLANES        (__aline->_VPLANES)
  489. #define    VWRAP        (__aline->_VWRAP)
  490. #define    CONTRL        (__aline->_CONTRL)
  491. #define    INTIN        (__aline->_INTIN)
  492. #define    PTSIN        (__aline->_PTSIN)
  493. #define    INTOUT        (__aline->_INTOUT)
  494. #define    PTSOUT        (__aline->_PTSOUT)
  495. #define    COLBIT0        (__aline->_COLBIT0)
  496. #define    COLBIT1        (__aline->_COLBIT1)
  497. #define    COLBIT2        (__aline->_COLBIT2)
  498. #define    COLBIT3        (__aline->_COLBIT3)
  499. #define    LSTLIN        (__aline->_LSTLIN)
  500. #define    LNMASK        (__aline->_LNMASK)
  501. #define    WMODE        (__aline->_WMODE)
  502. #define    X1        (__aline->_X1)
  503. #define    Y1        (__aline->_Y1)
  504. #define    X2        (__aline->_X2)
  505. #define    Y2        (__aline->_Y2)
  506. #define    PATPTR        (__aline->_PATPTR)
  507. #define    PATMSK        (__aline->_PATMSK)
  508. #define    MFILL        (__aline->_MFILL)
  509. #define    CLIP        (__aline->_CLIP)
  510. #define    XMINCL        (__aline->_XMINCL)
  511. #define    YMINCL        (__aline->_YMINCL)
  512. #define    XMAXCL        (__aline->_XMAXCL)
  513. #define    YMAXCL        (__aline->_YMAXCL)
  514. #define    XDDA        (__aline->_XDDA)
  515. #define    DDAINC        (__aline->_DDAINC)
  516. #define    SCALDIR        (__aline->_SCALDIR)
  517. #define    MONO        (__aline->_MONO)
  518. #define    SOURCEX        (__aline->_SOURCEX)
  519. #define    SOURCEY        (__aline->_SOURCEY)
  520. #define    DESTX        (__aline->_DESTX)
  521. #define    DESTY        (__aline->_DESTY)
  522. #define    DELX        (__aline->_DELX)
  523. #define    DELY        (__aline->_DELY)
  524. #define    FBASE        (__aline->_FBASE)
  525. #define    FWIDTH        (__aline->_FWIDTH)
  526. #define    STYLE        (__aline->_STYLE)
  527. #define    LITEMASK    (__aline->_LITEMASK)
  528. #define    SKEWMASK    (__aline->_SKEWMASK)
  529. #define    WEIGHT        (__aline->_WEIGHT)
  530. #define    ROFF        (__aline->_ROFF)
  531. #define    LOFF        (__aline->_LOFF)
  532. #define    SCALE        (__aline->_SCALE)
  533. #define    CHUP        (__aline->_CHUP)
  534. #define    TEXTFG        (__aline->_TEXTFG)
  535. #define    SCRTCHP        (__aline->_SCRTCHP)
  536. #define    SCRPT2        (__aline->_SCRPT2)
  537. #define    TEXTBG        (__aline->_TEXTBG)
  538. #define    COPYTRAN    (__aline->_COPYTRAN)
  539. #define    SEEDABORT    (__aline->_SEEDABORT)
  540.  
  541.     /* A pointer to array of type __FONT is returned by the Line A 
  542.      * init call ($A000), in register A1.
  543.          * This pointer is saved in the global array variable 'fonts[]'.
  544.      *
  545.      */
  546.  
  547. typedef struct _font {
  548.  
  549. /* Type    Name       Offset   Function            Comments             */
  550. /* ------------------------------------------------------------------------- */
  551.    short  font_id;    /*  0 Font face identifier  1 == system font           */
  552.                       /*                                                     */
  553.    short  size;       /*  2 Font size in points                              */
  554.                       /*                                                     */
  555.    char   name[32];   /*  4 Face name                                        */
  556.                       /*                                                     */
  557.    short  first_ade;  /* 36 Lowest ADE value in the face (lowest ASCII value */
  558.                       /*    of displayable character).                       */
  559.                       /*                                                     */
  560.    short  last_ade;   /* 38 Highest ADE value in the face (highest ASCII valu*/
  561.                       /*    of displayable character).                       */
  562.                       /*                                                     */
  563.    short  top;        /* 40 Distance of top line relative to baseline        */
  564.                       /*                                                     */
  565.    short  ascent;     /* 42 Distance of ascent line relative to baseline     */
  566.                       /*                                                     */
  567.    short  half;       /* 44 Distance of half line relative to baseline       */
  568.                       /*                                                     */
  569.    short  descent;    /* 46 Distance of decent line relative to baseline     */
  570.                       /*                                                     */
  571.    short  bottom;     /* 48 Distance of bottom line relative to baseline     */
  572.                       /*    All distances are measured in absolute values    */
  573.                       /*    rather than as offsets. They are always +ve      */
  574.                       /*                                                     */
  575. short max_char_width; /* 50 Width of the widest character in font            */
  576.                       /*                                                     */
  577. short max_cell_width; /* 52 Width of the widest cell character cell in face  */
  578.                       /*                                                     */
  579.   short left_offset;  /* 54 Left Offset see Vdi appendix G                   */
  580.                       /*                                                     */
  581.   short right_offset; /* 56 Right offset   "      "     "                    */
  582.                       /*                                                     */
  583.    short  thicken;    /* 58 Number of pixels by which to thicken characters  */
  584.                       /*                                                     */
  585.    short  ul_size;    /* 60 Width in  pixels of the underline                */
  586.                       /*                                                     */
  587.    short  lighten;    /* 62 The mask used to lighten characters              */
  588.                       /*                                                     */
  589.    short  skew;       /* 64 The mask used to determine when to perform       */
  590.                       /*    additional rotation on the character to perform  */
  591.                       /*    skewing                                          */
  592.                       /*                                                     */
  593.    short  flags;      /* 66 Flags                                            */
  594.                       /*      bit 0 set if default system font               */
  595.                       /*      bit 1 set if horiz offset table should be used */
  596.                       /*      bit 2 byte-swap flag (thanks to Intel idiots)  */
  597.                       /*      bit 3 set if mono spaced font                  */
  598.                       /*                                                     */
  599.    char   *h_table;   /* 68 Pointer to horizontal offset table               */
  600.                       /*                                                     */
  601.    short  *off_table; /* 72 Pointer to character offset table                */
  602.                       /*                                                     */
  603.    char   *dat_table; /* 76 Pointer to font data                             */
  604.                       /*                                                     */
  605.    short  form_width; /* 80 Form width (#of bytes /scanline in font data)    */
  606.                       /*                                                     */
  607.    short  form_height;/* 82 Form height (#of scanlines in font data)         */
  608.                       /*                                                     */
  609.  struct _font *next_font;  /* 84 Pointer to next font in face                */
  610.                       /*                                                     */
  611. /* ------------------------------------------------------------------------- */
  612. } __FONT;
  613.  
  614.     /* function pointer array
  615.          * pointer to array is returned in A2 after a init (A000) call
  616.      * array contains pointers to the 16 lineA routines, allowing
  617.      * you to call the routines directly without incurring the
  618.      * overhead of processing a lineA exception. You must be in
  619.      * supervisor mode to call any of the routines directly
  620.      */
  621. typedef short(*FPTR) __PROTO((void));
  622. typedef FPTR *FUNCPTR; /* array of pointers to functions returning short */
  623.     
  624.     /*
  625.      * OP_TAB type required for Bit Blt parameter block.
  626.      * each entry defines the logic operation to apply for
  627.      * the 4 Fore/Back ground bit combinations
  628.      */
  629. typedef struct {
  630.  
  631. /* Type    Name       Offset   Function            Comments             */
  632. /* ------------------------------------------------------------------------- */
  633.    char   fg0bg0;     /* 0    Logic op to employ when both FG and BG are 0 */
  634.    char   fg0bg1;     /* 1    Logic op to employ when FG = 0 and BG = 1    */
  635.    char   fg1bg0;     /* 2    Logic op to employ when FG = 1 and BG = 0    */
  636.    char   fg1bg1;     /* 3    Logic op to employ when both FG and BG are 1 */
  637. /* ------------------------------------------------------------------------- */
  638. } OP_TAB;
  639.  
  640.  
  641. /*
  642.  * Source and destination description blocks
  643.  */
  644. typedef struct  {
  645.     short    bl_xmin;        /* Minimum x            */
  646.     short    bl_ymin;        /* Minimum y             */
  647.     char    *bl_form;        /* short aligned memory form     */
  648.     short    bl_nxwd;        /* Offset to next word in line  */
  649.     short     bl_nxln;        /* Offset to next line in plane */
  650.     short     bl_nxpl;        /* Offset to next plane     */
  651. }SDDB;
  652.  
  653.     /* Offsets to next word in plane */
  654. #define HI_NXWD        2        /* Hi Rez            */
  655. #define MED_NXWD    4
  656. #define LOW_NXWD    8        /* lo Rez            */
  657.  
  658.     /* Scan line widths of the screen */
  659. #define HI_NXLN        80        /* Hi Rez            */
  660. #define MED_NXLN    160
  661. #define LOW_NXLN    160        /* lo Rez            */
  662.  
  663.     /*
  664.      * Offsets between planes - always the same due to
  665.      * the way the STs video memory is laid out
  666.          */
  667. #define NXPL        2
  668.  
  669.     /* 
  670.      * Bit Blt Parameter Block Type (for function $A007)
  671.      *
  672.      */
  673.  
  674. typedef struct {
  675.  
  676. /* Type    Name           Offset   Function            Comments         */
  677. /* ------------------------------------------------------------------------- */
  678.    short   bb_b_wd;     /*     width of block in pixels              */
  679.    short   bb_b_ht;     /*     height of block in pixels             */
  680.    short   bb_plane_ct; /*     number of planes to blit              */
  681.    short   bb_fg_col;   /*     foreground color                  */
  682.    short   bb_bg_col;   /*     back    ground color                  */
  683.    OP_TAB  bb_op_tab;   /*     logic for fg x bg combination              */
  684.    SDDB       bb_s;        /*     source info block                 */
  685.    SDDB       bb_d;        /*     destination info block              */
  686.    short   *bb_p_addr;  /*     pattern buffer address              */
  687.    short   bb_p_nxln;   /*     offset to next line in pattern          */
  688.    short   bb_p_nxpl;   /*     offset to next plane in pattern          */
  689.    short   bb_p_mask;   /*     pattern index mask                  */
  690.    char       bb_fill[24];    /*     work space                     */
  691. /* ------------------------------------------------------------------------- */
  692. } BBPB;
  693.  
  694.  
  695. #ifndef __MFDB__
  696. #define __MFDB__
  697. /*
  698.  * Memory Form Definition Block
  699.  *
  700.  */
  701. typedef struct
  702. {
  703.     char        *fd_addr;    /* Address of upper left corner of first*/
  704.                                      /* plane of raster area. If NULL then   */
  705.                                      /* MFDB is for a physical device        */
  706.     short        fd_w;         /* Form Width in Pixels                 */
  707.     short        fd_h;        /* Form Height in Pixels                */
  708.     short        fd_wdwidth;  /* Form Width in shorts(fd_w/sizeof(int)*/
  709.     short        fd_stand;    /* Form format 0= device spec 1=standard*/
  710.     short        fd_nplanes;  /* Number of memory planes              */
  711.     short        fd_r1;       /* Reserved                             */
  712.     short        fd_r2;       /* Reserved                             */
  713.     short        fd_r3;       /* Reserved                             */
  714. } MFDB;
  715. #endif /* __MFDB__ */
  716.  
  717. /*
  718.  * Sprite definition block
  719.  *
  720.  */
  721. typedef struct
  722. {
  723.     short    sp_xhot;        /* Offset to X hot spot        */
  724.     short    sp_yhot;        /* Offset to Y hot spot        */
  725.     short    sp_format;        /* Format SP_VDI or SP_XOR     */
  726.     short    sp_bg;            /* Background color        */
  727.     short    sp_fg;            /* Foregroud color        */
  728.     short    sp_data[32];        /* Sprite data -         */
  729.                     /* Alternating words of back/fore */
  730.                     /* ground data              */
  731.                     /* Note that:              */
  732.                     /*   sprite save block is         */
  733.                     /*  10+VPLANES*64 bytes long      */
  734. } SFORM;
  735.  
  736.  
  737.  
  738. /*****************************************************************************\
  739. *                                                                      *
  740. *                             Global Variables                      *
  741. *                                                                      *
  742. \*****************************************************************************/
  743.  
  744.     /*
  745.      * Global Variables are defined in alglobal.c, extern every where else
  746.      *
  747.      */
  748.  
  749.     /* global vars */
  750. /* Pointer to line a parameter block returned by init     */
  751. extern __LINEA *__aline;
  752.  
  753. /* Array of pointers to the three system font  headers 
  754.    returned by init (in register A1)                   */
  755. extern __FONT  **__fonts;
  756.  
  757. /* Array of pointers to the 16 line a functions returned
  758.    by init (in register A2) only valid in ROM'ed TOS     */
  759. extern short  (**__funcs) __PROTO((void));
  760.  
  761.     /* Functions */
  762.  
  763. #ifdef __GNUC_INLINE__
  764.  
  765. #define linea0()                             \
  766. ({                                    \
  767.                                         \
  768.     __asm__ volatile                        \
  769.     ("\
  770.         .word   0xA000; \
  771.         movl    a0,%0;    \
  772.         movl    a1,%1;    \
  773.         movl    a2,%2"                        \
  774.     : "=g"(__aline), "=g"(__fonts), "=g"(__funcs)     /* outputs */    \
  775.     :                           /* inputs  */    \
  776.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  777.     );                                \
  778. })
  779.  
  780. #define linea1()                             \
  781. ({                                    \
  782.                                         \
  783.     __asm__ volatile                        \
  784.     ("\
  785.         .word   0xA001" \
  786.     :                           /* outputs */    \
  787.     :                           /* inputs  */    \
  788.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  789.     );                                \
  790. })
  791.  
  792. #define linea2()                             \
  793. ({                                    \
  794.     short retvalue;                            \
  795.     __asm__ volatile                        \
  796.     ("\
  797.         .word   0xA002;  \
  798.          movew    d0,%0"   \
  799.     : "=g"(retvalue)                  /* outputs */    \
  800.     :                           /* inputs  */    \
  801.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  802.     );                                \
  803.     (int)retvalue;                            \
  804. })
  805.  
  806. #define linea3()                             \
  807. ({                                    \
  808.                                         \
  809.     __asm__ volatile                        \
  810.     ("\
  811.         .word   0xA003" \
  812.     :                           /* outputs */    \
  813.     :                           /* inputs  */    \
  814.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  815.     );                                \
  816. })
  817.  
  818. #define linea4()                             \
  819. ({                                    \
  820.                                         \
  821.     __asm__ volatile                        \
  822.     ("\
  823.         .word   0xA004" \
  824.     :                           /* outputs */    \
  825.     :                           /* inputs  */    \
  826.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  827.     );                                \
  828. })
  829.  
  830. #define linea5()                             \
  831. ({                                    \
  832.                                         \
  833.     __asm__ volatile                        \
  834.     ("\
  835.         .word   0xA005" \
  836.     :                           /* outputs */    \
  837.     :                           /* inputs  */    \
  838.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  839.     );                                \
  840. })
  841.  
  842. #define linea6()                             \
  843. ({                                    \
  844.                                         \
  845.     __asm__ volatile                        \
  846.     ("\
  847.         .word   0xA006" \
  848.     :                           /* outputs */    \
  849.     :                           /* inputs  */    \
  850.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  851.     );                                \
  852. })
  853.  
  854. #define linea7(P)                             \
  855. ({                                    \
  856.                                         \
  857.     __asm__ volatile                        \
  858.     ("\
  859.         movml    d2/a2/a6, sp@-; \
  860.          movl    %0,a6;  \
  861.         .word   0xA007; \
  862.         movml    sp@+, d2/a2/a6" \
  863.     :                           /* outputs */    \
  864.     : "r"(P)                      /* inputs  */    \
  865.     : "d0", "d1", "a0", "a1"          /* clobbered regs */    \
  866.     );                                \
  867. })
  868.  
  869. #define linea8()                             \
  870. ({                                    \
  871.                                         \
  872.     __asm__ volatile                        \
  873.     ("\
  874.         .word   0xA008" \
  875.     :                           /* outputs */    \
  876.     :                           /* inputs  */    \
  877.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  878.     );                                \
  879. })
  880.  
  881. #define linea9()                             \
  882. ({                                    \
  883.                                         \
  884.     __asm__ volatile                        \
  885.     ("\
  886.         .word   0xA009" \
  887.     :                           /* outputs */    \
  888.     :                           /* inputs  */    \
  889.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  890.     );                                \
  891. })
  892.  
  893. #define lineaa()                             \
  894. ({                                    \
  895.                                         \
  896.     __asm__ volatile                        \
  897.     ("\
  898.         .word   0xA00A" \
  899.     :                           /* outputs */    \
  900.     :                           /* inputs  */    \
  901.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  902.     );                                \
  903. })
  904.  
  905. #define lineab()                             \
  906. ({                                    \
  907.                                         \
  908.     __asm__ volatile                        \
  909.     ("\
  910.         .word   0xA00B" \
  911.     :                           /* outputs */    \
  912.     :                           /* inputs  */    \
  913.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  914.     );                                \
  915. })
  916.  
  917. #define lineac(P)                             \
  918. ({                                    \
  919.                                         \
  920.     __asm__ volatile                        \
  921.     ("\
  922.          movl    %0,a2;  \
  923.         .word   0xA00C" \
  924.     :                           /* outputs */    \
  925.     : "r"(P)                      /* inputs  */    \
  926.     : "d0", "d1", "d2", "a0", "a1", "a2", "a6" /* clobbered regs */    \
  927.     );                                \
  928. })
  929.  
  930. #define linead(x, y, sd, ss)    __linead((short)x, (short)y, (void *)sd, (void *)ss)
  931. #define __linead(x, y,  sd, ss)                        \
  932. ({                                    \
  933.                                         \
  934.     __asm__ volatile                        \
  935.     ("\
  936.          movw    %0,d0;  \
  937.          movw    %1,d1;  \
  938.          movl    %2,a0;  \
  939.          movl    %3,a2;  \
  940.         .word   0xA00D" \
  941.     :                           /* outputs */    \
  942.     : "r"(x), "r"(y), "r"(sd), "r"(ss)          /* inputs  */    \
  943.     : "d0", "d1", "d2", "a0", "a1", "a2", "a6" /* clobbered regs */    \
  944.     );                                \
  945. })
  946.  
  947. #define lineae()                             \
  948. ({                                    \
  949.                                         \
  950.     __asm__ volatile                        \
  951.     ("\
  952.         .word   0xA00E" \
  953.     :                           /* outputs */    \
  954.     :                           /* inputs  */    \
  955.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  956.     );                                \
  957. })
  958.  
  959. #define lineaf()                             \
  960. ({                                    \
  961.                                         \
  962.     __asm__ volatile                        \
  963.     ("\
  964.         .word   0xA00F" \
  965.     :                           /* outputs */    \
  966.     :                           /* inputs  */    \
  967.     : "d0", "d1", "d2", "a0", "a1", "a2"       /* clobbered regs */    \
  968.     );                                \
  969. })
  970.  
  971. #else    /* __NO_INLINE__ */
  972.  
  973. __EXTERN void linea0 __PROTO((void));
  974. __EXTERN void linea1 __PROTO((void));
  975. __EXTERN int linea2 __PROTO((void));
  976. __EXTERN void linea3 __PROTO((void));
  977. __EXTERN void linea4 __PROTO((void));
  978. __EXTERN void linea5 __PROTO((void));
  979. __EXTERN void linea6 __PROTO((void));
  980. __EXTERN void linea7 __PROTO((BBPB *P));
  981. __EXTERN void linea8 __PROTO((void));
  982. __EXTERN void linea9 __PROTO((void));
  983. __EXTERN void lineaa __PROTO((void));
  984. __EXTERN void lineab __PROTO((void));
  985. __EXTERN void lineac __PROTO((void *P));
  986. __EXTERN void linead __PROTO((int x, int y, SFORM *sd, void *ss));
  987. __EXTERN void lineae __PROTO((void));
  988. __EXTERN void lineaf __PROTO((void));
  989.  
  990. #endif /* __GNUC_INLINE__ */
  991.  
  992. #ifdef __cplusplus
  993. }
  994. #endif
  995.  
  996. #endif /* _LINEA_H */
  997.